import { axios } from '@/utils/request'

const root = '/admin/'
const api = {
    /** 相册分组 */
    photoAlbumGroup: root + 'photoAlbumGroup',

    /** 相册 */
    photoAlbum: root + 'photoAlbum',

    /** 照片 */
    photo: root + 'photo'

}

/**
 * 相册分组
 * 
 */
//相册分组列表
export function photoAlbumGroup() {
    return axios({
        url: api.photoAlbumGroup + '/list',
        method: 'get'
    })
}

//新增相册分组
export function addPhotoAlbumGroup(data) {
    return axios({
        url: api.photoAlbumGroup,
        method: 'post',
        data
    })
}

//编辑相册分组
export function editPhotoAlbumGroup(data) {
    return axios({
        url: api.photoAlbumGroup,
        method: 'put',
        data
    })
}

//删除相册分组
export function delPhotoAlbumGroup(id) {
    return axios({
        url: api.photoAlbumGroup + `/del/${id}`,
        method: 'delete'
    })
}

//强制删除相册分组
export function forceDelPhotoAlbumGroup(id) {
    return axios({
        url: api.photoAlbumGroup + `/forceDel/${id}`,
        method: 'delete'
    })
}

/**
 * 相册
 * 
 */
//相册列表
export function photoAlbum(params) {
    return axios({
        url: api.photoAlbum + '/list',
        method: 'get',
        params
    })
}

//新增相册
export function addPhotoAlbum(data) {
    return axios({
        url: api.photoAlbum,
        method: 'post',
        data
    })
}

//编辑相册
export function editPhotoAlbum(data) {
    return axios({
        url: api.photoAlbum,
        method: 'put',
        data
    })
}

//相册详情
export function photoAlbumDetail(id) {
    return axios({
        url: api.photoAlbum + `/details/${id}`,
        method: 'get',
    })
}

//删除相册
export function delPhotoAlbum(id) {
    return axios({
        url: api.photoAlbum + `/del/${id}`,
        method: 'delete',
    })
}

//强制删除相册
export function forceDelPhotoAlbum(id) {
    return axios({
        url: api.photoAlbum + `/forceDel/${id}`,
        method: 'delete',
    })
}

//调整相册顺序
export function swapPhotoAlbum(data) {
    return axios({
        url: api.photoAlbum + `/swap`,
        method: 'post',
        data
    })
}

//相册置顶
export function photoAlbumTop(id) {
    return axios({
        url: api.photoAlbum + `/top/${id}`,
        method: 'get'
    })
}

/**
 * 照片
 */
//照片列表
export function photo(params) {
    return axios({
        url: api.photo + '/list',
        method: 'get',
        params
    })
}

//批量保存照片
export function addPhoto(data) {
    return axios({
        url: api.photo + '/addBatch',
        method: 'post',
        data
    })
}

//批量删除照片
export function delPhoto(data) {
    return axios({
        url: api.photo + '/delBatch',
        method: 'post',
        data
    })
}